<%@include file="/WEB-INF/jsp/common/header.jsp" %>

<script>
    $(document).ready(function() {

        //MAIN FORM
        //Click Save button
        $("a.save").click(function() {
            $("#region-create-form").submit();
        });
    });
</script>
<div id="Content">
    <div class="metadata">
        <form:form id="region-create-form" modelAttribute="region" action="./create.html" method="POST">

        <c:if test="${region.id==null}">
            <h2><spring:message code="administration.region.create"/></h2>
        </c:if>
        <c:if test="${region.id!=null}">
            <h2><spring:message code="administration.region.modify"/></h2>
        </c:if>
        <a class="back action-link" href="./list.html"><spring:message code="back"/></a>
        <a class="save action-link" href="javascript:void(0)"><spring:message code="save"/></a>
        <c:if test="${region.id!=null}">
            <a class="cancel action-link" href="./delete.html?id=${region.id}"><spring:message code="delete"/></a>
        </c:if>

    </div>

    <div class="post">
        <div class="entry">
            <div>
                <h2><spring:message code="administration.region.information"/></h2>
            </div>

            <table>
                <tr>
                    <div class="form-line">
                        <td class="form-table-label">
                            <form:label for="name" path="name" cssErrorClass="error">
                                <spring:message code="column.name"/>
                            </form:label>
                        </td>
                        <td>
                            <form:input cssClass="store-input" path="name"/><span class="mandatory">*</span>
                            <form:errors path="name"/>
                        </td>
                        <c:if test="${region.id!=null}">
                            <form:hidden path="id"/>
                        </c:if>

                    </div>
                </tr>
                <tr>
                    <div class="form-line">
                        <td class="form-table-label">
                            <form:label for="country" path="country" cssErrorClass="error">
                                <spring:message code="country"/>
                            </form:label>
                        </td>
                        <td>
                            <form:select cssClass="select" path="countryId">
                                <form:option value=""></form:option>
                                <form:options items="${countries}" itemValue="id" itemLabel="name"/>
                            </form:select><span class="mandatory">*</span>
                            <form:errors path="country"/>
                        </td>
                    </div>
                </tr>
            </table>

        </div>

    </div>
    </form:form>
</div>


<%@include file="/WEB-INF/jsp/common/footer.jsp" %>